package com.sgcc.nrxt.crmdemo.constant;

import lombok.Getter;

/**
 * 00发电，01输电，0101输电架空，0102输电电缆，02变电，03配电，04直流，05用电
 */
@Getter
public enum ProfessionType {
    _GE_("00","发电","_GE_"),
    _TS_("01","输电","_TS_"),
    _TS_OVERHEAD("0101","输电线路","_TS_OVERHEAD"),
    _TS_CABLE("0102","输电电缆","_TS_CABLE"),
    _TS_OVERHEAD_SPLIT("0103","输电线路拆分","_TS_OVERHEAD_SPLIT"),
    _TF_("02","变电","_TF_"),
    _AUC_("02","变电站辅设备","_AUC_"),
    _PD_("02","变电二次保护设备","_PD_"),
    _AE_("02","变电二次自动化设备","_AE_"),
    _SS_("02","变电二次安全自动设备","_SS_"),
    _ADC_("02","变电二次生产辅助设备","_ADC_"),
    _DS_("03","配电","_DS_"),
    _DS_MID_VOL("0301","配电中压","_DS_MID_VOL"),
    _DS_LV_VOL("0302","配电低压","_DS_LV_VOL"),
    _DC_("04","直流","_DC_"),
    _DC_ONLY("0400","仅直流","_DC_ONLY"),
    _PR_("00","保电","_PR_"),
    _LV_("05","低压","_LV_"),;
    private String code;

    private String msg;

    private String professStr;

    ProfessionType(String code, String msg, String professStr) {
        this.code = code;
        this.msg = msg;
        this.professStr = professStr;
    }

    public static int getDistribution(String professionCode) {
        if (_TS_.getCode().equals(professionCode)
                || _TS_CABLE.getCode().equals(professionCode)
                || _TS_OVERHEAD.getCode().equals(professionCode)
                || _TF_.getCode().equals(professionCode)
                || _DC_.getCode().equals(professionCode)) {
            return 1;
        }else  {
            return 0;
        }
    }

    public static ProfessionType getProfessionType(String tableName) {
        for(ProfessionType professionType : ProfessionType.values()){
            if(tableName.contains(professionType.professStr)){
                return professionType;
            }
        }
        return ProfessionType._DS_;
    }

}
